package com.study.zzedu.ui.discussdetail;

import android.content.Context;

import com.study.zzedu.base.BasePresenter;
import com.study.zzedu.base.BaseView;
import com.study.zzedu.http.OnResultListener;

public class DiscussDetailPresenter extends BasePresenter<DiscussDetailContract.IView> {
    private DiscussDetailModel tModel;
    public DiscussDetailPresenter(){
        this.tModel = new DiscussDetailModel();
    }

    //得到消息记录
    public void getDiscussDetail(Context context,String contentID,String pageNum,String pageSize){
        tModel.getDiscussDetail(context,contentID,pageNum,pageSize,new OnResultListener() {
            @Override
            public void onSuccess(String result) {
                getView().getDataList(result);
            }

            @Override
            public void onError(String error) {
                getView().showError(error);
            }
        });
    }

    //发送消息
    public void sendData(Context context,String contentID,String msg){
        tModel.sendData(context,contentID,msg,new OnResultListener() {
            @Override
            public void onSuccess(String result) {
                getView().getMsgReply(result);
            }

            @Override
            public void onError(String error) {
                getView().showError(error);
            }
        });
    }
}
